<template>
  <div class='full-money first-box'>
    <Head :info="info"></Head>
    <GreyLine></GreyLine>
    <ChooseMoney :listData="chooseData"></ChooseMoney>
    <GreyLine></GreyLine>
    <ChargeType></ChargeType>
    <Btn class="margin40" :buttonData="buttonData"></Btn>
  </div>
</template>
<script>
import Head from './common/head'
import GreyLine from '../../common/line.vue'
import ChooseMoney from './common/choosemoney.vue'
import ChargeType from './common/chargetype.vue'
import Btn from '../../common/button.vue'
export default {
  components: {Head,GreyLine,ChooseMoney,ChargeType,Btn},
  name: "",
  data() {
    return {
      info:{
        cardnum:'',
        remained:'0.00',//余额
        id:""
      },
      chooseData:[
        // {
        //   money:"1000",
        //   gived:"10",
        //   active:true
        // },{
        //   money:"1000",
        //   gived:"10",
        //   active:false
        // },{
        //   money:"1000",
        //   gived:"10",
        //   active:false
        // },{
        //   money:"1000",
        //   gived:"10",
        //   active:false
        // },{
        //   money:"1000",
        //   gived:"10",
        //   active:false
        // }
      ],
      buttonData:[
        {
          label:"确认支付",
          click:this.save
        }
      ]
    };
  },
  methods: {
    save(){
      console.log("click---支付")
    },

    getInfo(){
      _g.apiPost("vipCenter/init.do").then(res=>{
        if(res.status==1){
          _g.toMessage(res)
          return
        }
        this.info.cardnum=res.data.phone
        this.info.remained=res.data.money
        this.info.id=res.data.id
      })

      _g.apiPost("platform/getRechargeList.do").then(res=>{
        var goal=[]
        res.data.list.forEach(ele => {
          goal.push({
            money:ele.rechargeAmount,
            gived:ele.donationAmount
          })
        });
        this.$set(this,"chooseData",goal)
      })
    }
  },
  created() {
    this.getInfo()
  }
};
</script>
<style lang="scss" scoped>
.full-money{
  .margin40{
    margin: 40px 15px 20px;
  }
}
</style>